Skip to content

fix(e2b): wake PTY output collection on process exit#3610

Merged
seratch merged 3 commits into
openai:mainfrom
The-LLM-Data-Company:fix/e2b-pty-exit-wakeup
Jun 22, 2026
Merged

fix(e2b): wake PTY output collection on process exit#3610
seratch merged 3 commits into
openai:mainfrom
The-LLM-Data-Company:fix/e2b-pty-exit-wakeup

Conversation

@rohitrastogi

@rohitrastogi rohitrastogi commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

E2B PTY output collection only woke when stdout/stderr/PTY output arrived. If a process exited after its final output chunk, or exited without output, pty_exec_start and pty_write_stdin could wait until the full yield_time_s window before observing completion. This added avoidable latency to E2B-backed tool calls, which compounded across multi-turn episodes.

To fix this, I've added a small waiter task for each E2B AsyncCommandHandle to treat process exit as a new output-collection wakeup signal, matching the Daytona extension's existing _run_pty_waiter pattern (Modal achieves the same by polling exit inline during collection).

No documentation changes; this is an internal bugfix with no public API change.

Test plan

  • make format
  • make lint
  • make typecheck
  • uv run pytest -q tests/extensions/sandbox/test_e2b.py

Added regression coverage for:

  • output followed by process exit before the yield window expires
  • quiet process exit with no output
  • nonzero process exit via E2B CommandExitException
  • outer tty=True PTY session exit
  • still-running command cleanup cancelling the waiter and killing the handle

Issue number

Closes #3609

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

@seratch seratch added this to the 0.17.x milestone Jun 22, 2026
@seratch seratch merged commit 0bd3d1b into openai:main Jun 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E2B PTY output collection can wait until yield timeout after process exit

2 participants